package com.tmxk.days01.carrental_wmh;

public class Car extends MotoVehicle {

    private String type;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Car() {
    }

    public Car(String brand, String vehicleId, int perRent, String type) {
        super(brand, vehicleId, perRent);
        this.type = type;
    }

    @Override
    public float calRent(int days) {
        float rentPrice = super.getPerRent() * days;
        float discount = 0;
        if (days >= 150) {
            //rentPrice = （float）（rentPrice * 0.7);
            discount = 0.7f;
        } else if (days >= 30) {
            rentPrice = (float) (rentPrice * 0.8);
        } else if (days >= 7) {
            rentPrice = (float) (rentPrice * 0.9);
            discount = 0.9f;
        }
        return rentPrice * discount;
    }

    @Override
    public String toString() {
        return super.toString() + "Car{" +
                "type='" + type + '\'' +
                '}';
    }
}
